public class Learn13 {
    public static String myToString(int[] array){    //模拟实现Arrays.toString
        String array2 = "[";
        for (int i = 0; i < array.length; i++) {
            if(i == array.length - 1){
                array2 += array[i] + "]";
            }else{
                array2 += array[i]+",";
            }
        }
        return array2;
    }
    public static void main(String[] args) {
        int[] array = {1,2,3,4,5};
        System.out.println(myToString(array));
    }
}
